package StudyCode.summary.mycollection;

import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class UnionToHashSet {
	public static void main(String[] argv) {
		List collections = Arrays.asList("科技与人文", "www.tah1986.com");
		System.out.println(unionToHashSet(collections));
	}

	public static <T> HashSet<T> unionToHashSet(final Collection<T>... collections) {
		final HashSet<T> res = new HashSet<T>();
		for (final Collection<T> set : collections) {
			res.addAll(set);
		}
		return res;
	}
}
